package com.hnhs.controller;

import com.hnhs.dto.ResponseDTO;
import com.hnhs.model.Category;
import com.hnhs.model.CategoryQuery;
import com.hnhs.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public List<Category> select(CategoryQuery query){
        return categoryService.select(query);
    }

    @PostMapping
    public int insert(@RequestBody Category category){
        return categoryService.insert(category);
    }

    @PutMapping
    public int update(@RequestBody Category category){
        return categoryService.update(category);
    }
    @DeleteMapping
    public int delete(Integer id){
        return categoryService.delete(id);
    }



}
